<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增时间轴')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-m-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">名称：</label>
                <div class="col-sm-8">
                    <input name="timeTitle" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" placeholder="备注，建议不超过50个字字符" class="form-control" required maxlength="250"
                              style="resize:none;color: #b3b3b3;border-radius: 0;border: none;height: 135px;background-color: #F8F8F8;"
                              onkeyup="textareaLength(this,250,'textareaMaxLength');"></textarea>
                    <span id="textareaMaxLength" style="font-size:12px;float:right;right:0px;top:-5px;">0/250</span>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "memorial/TimeLineM"
        $("#form-m-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-m-add').serialize());
            }
        }

        // 限制文本框字数
        function textareaLength(obj,maxlength,id){
            var num=maxlength-obj.value.length;//获取文本框输入内容的长度
            if(num<0){
                num=0;//如果文本框文字小于零则让它显示为零
            }
            // document.getElementById(leng).innerHTML="/50";
            //通过id获取到span标签在页面上的显示并对它的值进行拼接,就是把计算出来的结果+最大限制字数
            document.getElementById(id).innerHTML=num+"/"+maxlength;
        }

    </script>
</body>
</html>